﻿namespace DataInit.DataContexts
{
    using DataInit.Entities;
    using Microsoft.EntityFrameworkCore;
    using Performance.Entities;
    using Stee.CAP8.DBAccess;
    using Stee.CAP8.Entity;

    public class PTDBContext : BaseDBContext
    {
        public PTDBContext(DbContextOptions<PTDBContext> options) : base(options) { }



        public PTDBContext() : this(false) { }
        public PTDBContext(bool useOracle) : this(null, useOracle) { }
        public PTDBContext(string connectionString, bool useOracle = true) : base(connectionString, useOracle) { }

        public DbSet<ActionEntity> ActionEntity { get; set; }
        public DbSet<Appliance> ApplianceEntity { get; set; }
        public DbSet<LoginOperator> LoginOperatorEntity { get; set; }
        public DbSet<Incident> IncidentEntity { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            if (modelBuilder != null)
            {
                modelBuilder.ApplyConfiguration(new BaseEntityConfiguration<ActionEntity>());
                modelBuilder.Entity<ActionEntity>().ToTable("ActionEntity");

                modelBuilder.ApplyConfiguration(new BaseEntityConfiguration<Appliance>());
                modelBuilder.Entity<Appliance>().ToTable("Appliance");


                modelBuilder.ApplyConfiguration(new BaseEntityConfiguration<LoginOperator>());
                modelBuilder.Entity<LoginOperator>().ToTable("LoginOperator");


                modelBuilder.ApplyConfiguration(new BaseEntityConfiguration<Incident>());
                modelBuilder.Entity<Incident>().ToTable("Incident");

                modelBuilder.ApplyConfiguration(new BaseEntityConfiguration<IncidentAddress>());
                modelBuilder.Entity<IncidentAddress>().ToTable("IncidentAddress");


                modelBuilder.ApplyConfiguration(new BaseEntityConfiguration<IncCurrentRes>());
                modelBuilder.Entity<IncCurrentRes>().ToTable("IncCurrentRes");


                modelBuilder.ApplyConfiguration(new BaseEntityConfiguration<ResMonitor>());
                modelBuilder.Entity<ResMonitor>().ToTable("ResMonitor");


                modelBuilder.ApplyConfiguration(new BaseEntityConfiguration<Ambulance>());
                modelBuilder.Entity<Ambulance>().ToTable("Ambulance");


            }
        }


         

    }



}
